from django.conf.urls.defaults import *
from django.views.generic import DetailView, ListView
from notebook.models import Note

urlpatterns = patterns('',
        # Generic views
        url(r'^$',
            ListView.as_view(
                queryset=Note.objects.order_by('timestamp')[:5],
                context_object_name='allnotes',
                template_name='notebook/index.html')),
        #url(r'index$',
        #    ListView.as_view(
        #        queryset=Note.objects.order_by('-curr_date')[:5],
        #        context_object_name='latest_note',
        #        template_name='notebook/index.html')),
        #url(r'(?P<pk>\d+)/$',
        #    DetailView.as_view(
        #        model=Note,
        #        template_name='notebook/detail.html')),

        url(r'addnote/$', 'notebook.views.addnote'),
        #url(r'notes/graphics$', 'notebook.views.graphics'),
        url(r'note/(?P<note_id>\d+)/$', 
            'notebook.views.note_detail_by_id'),
        url(r'note/(?P<note_title>[a-zA-Z-_]+)/$', 
            'notebook.views.note_detail_by_title'),
        #url(r'contact/$', 'notebook.views.contact'),
        #url(r'thanks/$', 'notebook.views.thanks'),

        #url(r'(?P<poll_id>\d+)/vote/$', 'polls.views.vote'),
        url(r'^notes/(?P<year>\d{4})/$', 
            'notebook.views.year_archive'),
        #url(r'^notes/(?P<year>\d{4})/(?P<month>\d{2})/$', 
        #    'notebook.views.month_archive'),
        #url(r'^notes/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$', 
        #    'notebook.views.note_detail')
        url(r'intro/$', 'notebook.views.intro'),
)

